/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.DragonPokerServer.Thread.ServerRequest;

import org.Comunicator.Message;
import org.DragonPokerServer.Thread.ThreadUser;

/**
 *
 * @author davide
 */
public abstract class GenericServerRequest {

    protected GenericServerRequest next = null;

    public abstract void processRequest(Message message, ThreadUser user);

    public abstract boolean isToProcessing(Message message, ThreadUser user);

    public void startProcessing(Message message, ThreadUser user) {
        System.out.println("SERVER: chain " + getClass().getName());
        if (isToProcessing(message, user) == true) {
            processRequest(message, user);
        } else {
            if (next != null) {
                next.startProcessing(message, user);
            }
        }
    }

    public GenericServerRequest getNext() {
        return next;
    }

    public void setNext(GenericServerRequest next) {
        this.next = next;
    }
}
